* Attitudes toward Coronavirus Protection Measures among German School Students: The Effects of Education and Knowledge about the Pandemic  
* Sebastian Jäckle
* Thomas Waldvogel
* in Social Sciences (2022), 11


* Set your path to the replication folder here:
cd "YOURPATH\replication\"

clear all

/*
* install packages
ssc install estout, replace
ssc install stripplot, replace
ssc install coefplot, replace
ssc install asdoc, replace
ssc install mdesc, replace
*/

* Combine the three datasets from the three surveys from unipark (unipark SPSS outputs were converted to Stata .dta Files)
use "material\exp_growth_bias_pupils_1.dta" 
append using "material\exp_growth_bias_pupils_2.dta" 
append using "material\exp_growth_bias_pupils_3.dta" 

* drop irrelevant variables
drop rts* rnd*

* generate id
gen id = _n

save "material\exp_growth_bias_pupils_all.dta", replace 

* Lammers et al. Replication Data Study 3 (https://osf.io/xjwbg/) --> SPSS data converted to .dta
use "material\Lammers_Study3.dta", clear

* Merge survey data
merge 1:1 _n using "material\exp_growth_bias_pupils_all.dta" 

* rename variables
rename controlDV  lammers_est15_c_group_metric 
rename saturday28 lammers_est03_e_group_metric
rename tuesday31  lammers_est06_e_group_metric
rename friday3    lammers_est09_e_group_metric
rename monday6    lammers_est12_e_group_metric
rename thursday9  lammers_est15_e_group_metric
rename treatment  lammers_treatment

rename v_936  		size_place_of_residence
rename v_144 		strain
rename v_370 		gender                // v_1172 enthält noch die Freitextkommentare der "anderes"-Kategorie evtl. da vorher noch die Quatschkommentare zu männlich ändern?
rename v_773 		left_right
rename v_344 		trust
rename v_389 		restrict_rights
rename v_1149		gen_pol_int
rename v_1150		COVID_pol_int
rename v_332		knowledge_COVID_oneself
rename v_333		knowledge_COVID_classmates
rename v_334		knowledge_COVID_teacher
rename v_335		knowledge_COVID_parents
rename v_1162		eff_COVID_complicated
rename v_1163		eff_COVID_impact
rename v_1164		eff_COVID_understand
rename v_1165		eff_COVID_parties
rename v_553 		measures_appropriate
rename v_556 		measures_excessive
rename v_557 		COVID_decide_yourself
rename v_125		age
rename v_57			migration_background
rename v_20			school_type
rename v_1173		class_level
rename v_498		health_status
rename v_1133		vaccinated
rename v_1175		infected
rename v_1176		symptoms_cough
rename v_1177		symptoms_fever
rename v_1178		symptoms_snuff
rename v_1179		symptoms_smell
rename v_1180		symptoms_sore_throat
rename v_1181		symptoms_headache
rename v_1182		symptoms_nausea
rename v_1183		fear_of_infection
rename v_1187		COVID_affectedness
rename v_1216		quiz_1
rename v_297		quiz_2
rename v_303		quiz_3
rename v_304		quiz_4
rename v_316		quiz_5a
rename v_317		quiz_5b
rename v_318		quiz_5c
rename v_319		quiz_5d
rename dupl1_v_320	quiz_5e
rename dupl1_v_494	est15_c_group
rename dupl1_v_364 	est03_e_group
rename dupl1_v_365 	est06_e_group
rename dupl1_v_374 	est09_e_group
rename dupl1_v_379 	est12_e_group
rename dupl1_v_384 	est15_e_group
rename v_1228		contact_reductions
rename v_1229		mask_mandatory
rename v_1230		testing_mandatory
rename v_1231		alternate_lessons
rename v_1232		vaccination_mandatory
rename v_1233		post_exp_inform
rename v_1234		post_exp_test
rename v_1235		post_exp_omikron_vacc
rename v_1236		post_exp_mask
rename v_1237		post_exp_contact

replace lammers_est15_c_group_metric = 1000 * lammers_est15_c_group_metric
replace lammers_est15_e_group_metric = 1000 * lammers_est15_e_group_metric
replace lammers_est12_e_group_metric = 1000 * lammers_est12_e_group_metric
replace lammers_est09_e_group_metric = 1000 * lammers_est09_e_group_metric
replace lammers_est06_e_group_metric = 1000 * lammers_est06_e_group_metric
replace lammers_est03_e_group_metric = 1000 * lammers_est03_e_group_metric

* recode gender: Assumption, all nonsense answers (Kampfhelikopter, Donald Trump, Krokodil...) are men
replace gender = 1 if v_1172 == "Donald Trump"
replace gender = 1 if v_1172 == "Helikopter"
replace gender = 1 if v_1172 == "KampfHelikopter"
replace gender = 1 if v_1172 == "Kampfhelikopter"
replace gender = 1 if v_1172 == "Kampfhubschrauber flotte 37"
replace gender = 1 if v_1172 == "Kolbenringe"
replace gender = 1 if v_1172 == "Krokodil"
replace gender = 1 if v_1172 == "League of Legends Spieler"
replace gender = 1 if v_1172 == "Lokomotive"
replace gender = 1 if v_1172 == "Nilpferd"
replace gender = 1 if v_1172 == "Pfannenwendler"
replace gender = 1 if v_1172 == "Schlüsselanhänger"
replace gender = 1 if v_1172 == "Zug"
replace gender = 1 if v_1172 == "Zwidder"
replace gender = 1 if v_1172 == "giled abdi"
replace gender = 1 if v_1172 == "kampfhelikopter"

* knowledge_corona rescale 1-7
replace knowledge_COVID_oneself = knowledge_COVID_oneself -3 if knowledge_COVID_oneself >6
replace knowledge_COVID_classmates = knowledge_COVID_classmates -3 if knowledge_COVID_classmates >6
replace knowledge_COVID_teacher = knowledge_COVID_teacher -3 if knowledge_COVID_teacher >6
replace knowledge_COVID_parents = knowledge_COVID_parents -3 if knowledge_COVID_parents >6

label define knowledge 1 "not at all informed" 7 "very well informed"
label values knowledge* knowledge

label define school_type 3 "Secondary school (Realschule)" 5 "High school (Gymnasium)" 7 "Vocational school (Berufsschule)"
label values school_type school_type
label variable school_type "school type"

label define class_level 7 "grade 7" 8 "grade 8" 9 "grade 9" 10 "grade 10" 11 "grade 11" 12 "grade 12" 13 "1st year of vocational training" 14 "2nd year of vocational training" 15 "3rd year of vocational training"
label values class_level class_level
label variable class_level "grade"

* label symptoms
label define symptoms 1 "no symptoms" 2 "mild symptoms" 3 "moderate symptoms" 4 "severe symptoms"
label values symptoms* symptoms

* label fear_of_infection
label define fear_of_infection 1 "no fear at all" 2 "a little fear" 3 "medium fear" 4 "big fear" 5 "very big fear"
label values fear_of_infection fear_of_infection

* missing values 
mvdecode * , mv(-77)		
mvdecode * , mv(0)			

* replace 2 --> 0 in dummies
replace migration_background = 0 if migration_background == 2
replace COVID_affectedness = 0 if COVID_affectedness == 2
replace vaccinated = 0 if vaccinated == 4
replace infected = 0 if infected == 2

* gen label infected
label define infected 0 "not infected so far" 1 "have been infected"
label values infected infected

* gen age label
label define age 26 ">=25", replace
label values age age

* gen vaccinated label
label define vaccinated 1 "vaccinated once" 2 "vaccinated twice" 3 "vaccinated three times" 0 "not vaccinated", replace
label values vaccinated vaccinated

* gen quiz_1 label
label define quiz_1 1 "exponentially" 2 "linearly" 3 "polynomially" 4 "logartithmically"
label values quiz_1 quiz_1
label variable quiz_1 "Without countermeasures, the Coronavirus spreads ..."

* gen quiz_2 label
label variable quiz_2 "The scientifically correct name of the Coronavirus is?"

* gen quiz_3 label
label variable quiz_3 "Who is heading the Robert Koch Institute (RKI)?"

* gen quiz_4 label
label define quiz_4 1 "how many people an infected person infects on average."  2  "how long a person is contagious on average."  3  "how high the risk of infection by a person is."  4 "how long is the period in which the number of infected doubles."  5 "how high the viral load is."
label values quiz_4 quiz_4 
label variable quiz_4 "The R-value indicates..."

* reverse scale of dv --> 1 = strongly oppose, 10 = strongly support
replace contact_reductions 		= abs(contact_reduction - 11)
replace mask_mandatory			= abs(mask_mandatory - 11)
replace testing_mandatory 		= abs(testing_mandatory - 11)
replace alternate_lessons 		= abs(alternate_lessons - 11)
replace vaccination_mandatory 	= abs(vaccination_mandatory - 11)
* label reversed scale
label define dv 1 "strongly oppose" 10 "strongly support" 
label values contact_reductions 	dv
label values mask_mandatory 		dv
label values testing_mandatory 		dv
label values alternate_lessons 		dv
label values vaccination_mandatory 	dv

* Recode obviously wrong "Hauptschule" (there was no Hauptschule in the sample of schools) by grade
replace school_type = 5 if school_type == 1 & class ==12
replace school_type = 7 if school_type == 1 & class ==15

* estimations metric
* Control Group after 15 days
gen est15_c_group_metric = .
replace est15_c_group_metric = 50000 		if est15_c_group == 1
replace est15_c_group_metric = 100000 		if est15_c_group == 2
replace est15_c_group_metric = 150000 		if est15_c_group == 3
replace est15_c_group_metric = 200000 		if est15_c_group == 4
replace est15_c_group_metric = 250000 		if est15_c_group == 5
replace est15_c_group_metric = 300000 		if est15_c_group == 6
replace est15_c_group_metric = 350000 		if est15_c_group == 7
replace est15_c_group_metric = 400000 		if est15_c_group == 8
replace est15_c_group_metric = 450000 		if est15_c_group == 9
replace est15_c_group_metric = 500000 		if est15_c_group == 10
replace est15_c_group_metric = 550000 		if est15_c_group == 11
replace est15_c_group_metric = 600000 		if est15_c_group == 12
replace est15_c_group_metric = 650000 		if est15_c_group == 13
replace est15_c_group_metric = 700000 		if est15_c_group == 14
replace est15_c_group_metric = 750000 		if est15_c_group == 15
replace est15_c_group_metric = 800000 		if est15_c_group == 16
replace est15_c_group_metric = 850000 		if est15_c_group == 17
replace est15_c_group_metric = 900000 		if est15_c_group == 18
replace est15_c_group_metric = 950000 		if est15_c_group == 19
replace est15_c_group_metric = 1000000 		if est15_c_group == 20
replace est15_c_group_metric = 1100000 		if est15_c_group == 21
replace est15_c_group_metric = 1200000 		if est15_c_group == 22
replace est15_c_group_metric = 1300000 		if est15_c_group == 23
replace est15_c_group_metric = 1400000 		if est15_c_group == 24
replace est15_c_group_metric = 1500000 		if est15_c_group == 25
replace est15_c_group_metric = 1600000 		if est15_c_group == 26

* Treatment Group after 15 days
gen est15_e_group_metric = .
replace est15_e_group_metric = 50000 		if est15_e_group == 1
replace est15_e_group_metric = 100000 		if est15_e_group == 2
replace est15_e_group_metric = 150000 		if est15_e_group == 3
replace est15_e_group_metric = 200000 		if est15_e_group == 4
replace est15_e_group_metric = 250000 		if est15_e_group == 5
replace est15_e_group_metric = 300000 		if est15_e_group == 6
replace est15_e_group_metric = 350000 		if est15_e_group == 7
replace est15_e_group_metric = 400000 		if est15_e_group == 8
replace est15_e_group_metric = 450000 		if est15_e_group == 9
replace est15_e_group_metric = 500000 		if est15_e_group == 10
replace est15_e_group_metric = 550000 		if est15_e_group == 11
replace est15_e_group_metric = 600000 		if est15_e_group == 12
replace est15_e_group_metric = 650000 		if est15_e_group == 13
replace est15_e_group_metric = 700000 		if est15_e_group == 14
replace est15_e_group_metric = 750000 		if est15_e_group == 15
replace est15_e_group_metric = 800000 		if est15_e_group == 16
replace est15_e_group_metric = 850000 		if est15_e_group == 17
replace est15_e_group_metric = 900000 		if est15_e_group == 18
replace est15_e_group_metric = 950000 		if est15_e_group == 19
replace est15_e_group_metric = 1000000 		if est15_e_group == 20
replace est15_e_group_metric = 1100000 		if est15_e_group == 21
replace est15_e_group_metric = 1200000 		if est15_e_group == 22
replace est15_e_group_metric = 1300000 		if est15_e_group == 23
replace est15_e_group_metric = 1400000 		if est15_e_group == 24
replace est15_e_group_metric = 1500000 		if est15_e_group == 25
replace est15_e_group_metric = 1600000 		if est15_e_group == 26

* Treatment Group after 12 days
gen est12_e_group_metric = .
replace est12_e_group_metric = 50000 		if est12_e_group == 1
replace est12_e_group_metric = 100000 		if est12_e_group == 2
replace est12_e_group_metric = 150000 		if est12_e_group == 3
replace est12_e_group_metric = 200000 		if est12_e_group == 4
replace est12_e_group_metric = 250000 		if est12_e_group == 5
replace est12_e_group_metric = 300000 		if est12_e_group == 6
replace est12_e_group_metric = 350000 		if est12_e_group == 7
replace est12_e_group_metric = 400000 		if est12_e_group == 8
replace est12_e_group_metric = 450000 		if est12_e_group == 9
replace est12_e_group_metric = 500000 		if est12_e_group == 10
replace est12_e_group_metric = 550000 		if est12_e_group == 11
replace est12_e_group_metric = 600000 		if est12_e_group == 12
replace est12_e_group_metric = 650000 		if est12_e_group == 13
replace est12_e_group_metric = 700000 		if est12_e_group == 14
replace est12_e_group_metric = 750000 		if est12_e_group == 15
replace est12_e_group_metric = 800000 		if est12_e_group == 16
replace est12_e_group_metric = 850000 		if est12_e_group == 17
replace est12_e_group_metric = 900000 		if est12_e_group == 18
replace est12_e_group_metric = 950000 		if est12_e_group == 19
replace est12_e_group_metric = 1000000 		if est12_e_group == 20
replace est12_e_group_metric = 1100000 		if est12_e_group == 21
replace est12_e_group_metric = 1200000 		if est12_e_group == 22
replace est12_e_group_metric = 1300000 		if est12_e_group == 23
replace est12_e_group_metric = 1400000 		if est12_e_group == 24
replace est12_e_group_metric = 1500000 		if est12_e_group == 25
replace est12_e_group_metric = 1600000 		if est12_e_group == 26

* Treatment Group after 09 days
gen est09_e_group_metric = .
replace est09_e_group_metric = 50000 		if est09_e_group == 1
replace est09_e_group_metric = 100000 		if est09_e_group == 2
replace est09_e_group_metric = 150000 		if est09_e_group == 3
replace est09_e_group_metric = 200000 		if est09_e_group == 4
replace est09_e_group_metric = 250000 		if est09_e_group == 5
replace est09_e_group_metric = 300000 		if est09_e_group == 6
replace est09_e_group_metric = 350000 		if est09_e_group == 7
replace est09_e_group_metric = 400000 		if est09_e_group == 8
replace est09_e_group_metric = 450000 		if est09_e_group == 9
replace est09_e_group_metric = 500000 		if est09_e_group == 10
replace est09_e_group_metric = 550000 		if est09_e_group == 11
replace est09_e_group_metric = 600000 		if est09_e_group == 12
replace est09_e_group_metric = 650000 		if est09_e_group == 13
replace est09_e_group_metric = 700000 		if est09_e_group == 14
replace est09_e_group_metric = 750000 		if est09_e_group == 15
replace est09_e_group_metric = 800000 		if est09_e_group == 16
replace est09_e_group_metric = 850000 		if est09_e_group == 17
replace est09_e_group_metric = 900000 		if est09_e_group == 18
replace est09_e_group_metric = 950000 		if est09_e_group == 19
replace est09_e_group_metric = 1000000 		if est09_e_group == 20
replace est09_e_group_metric = 1100000 		if est09_e_group == 21
replace est09_e_group_metric = 1200000 		if est09_e_group == 22
replace est09_e_group_metric = 1300000 		if est09_e_group == 23
replace est09_e_group_metric = 1400000 		if est09_e_group == 24
replace est09_e_group_metric = 1500000 		if est09_e_group == 25
replace est09_e_group_metric = 1600000 		if est09_e_group == 26

* Treatment Group after 06 days
gen est06_e_group_metric = .
replace est06_e_group_metric = 50000 		if est06_e_group == 1
replace est06_e_group_metric = 100000 		if est06_e_group == 2
replace est06_e_group_metric = 150000 		if est06_e_group == 3
replace est06_e_group_metric = 200000 		if est06_e_group == 4
replace est06_e_group_metric = 250000 		if est06_e_group == 5
replace est06_e_group_metric = 300000 		if est06_e_group == 6
replace est06_e_group_metric = 350000 		if est06_e_group == 7
replace est06_e_group_metric = 400000 		if est06_e_group == 8
replace est06_e_group_metric = 450000 		if est06_e_group == 9
replace est06_e_group_metric = 500000 		if est06_e_group == 10
replace est06_e_group_metric = 550000 		if est06_e_group == 11
replace est06_e_group_metric = 600000 		if est06_e_group == 12
replace est06_e_group_metric = 650000 		if est06_e_group == 13
replace est06_e_group_metric = 700000 		if est06_e_group == 14
replace est06_e_group_metric = 750000 		if est06_e_group == 15
replace est06_e_group_metric = 800000 		if est06_e_group == 16
replace est06_e_group_metric = 850000 		if est06_e_group == 17
replace est06_e_group_metric = 900000 		if est06_e_group == 18
replace est06_e_group_metric = 950000 		if est06_e_group == 19
replace est06_e_group_metric = 1000000 		if est06_e_group == 20
replace est06_e_group_metric = 1100000 		if est06_e_group == 21
replace est06_e_group_metric = 1200000 		if est06_e_group == 22
replace est06_e_group_metric = 1300000 		if est06_e_group == 23
replace est06_e_group_metric = 1400000 		if est06_e_group == 24
replace est06_e_group_metric = 1500000 		if est06_e_group == 25
replace est06_e_group_metric = 1600000 		if est06_e_group == 26

* Treatment Group after 03 days
gen est03_e_group_metric = .
replace est03_e_group_metric = 50000 		if est03_e_group == 1
replace est03_e_group_metric = 100000 		if est03_e_group == 2
replace est03_e_group_metric = 150000 		if est03_e_group == 3
replace est03_e_group_metric = 200000 		if est03_e_group == 4
replace est03_e_group_metric = 250000 		if est03_e_group == 5
replace est03_e_group_metric = 300000 		if est03_e_group == 6
replace est03_e_group_metric = 350000 		if est03_e_group == 7
replace est03_e_group_metric = 400000 		if est03_e_group == 8
replace est03_e_group_metric = 450000 		if est03_e_group == 9
replace est03_e_group_metric = 500000 		if est03_e_group == 10
replace est03_e_group_metric = 550000 		if est03_e_group == 11
replace est03_e_group_metric = 600000 		if est03_e_group == 12
replace est03_e_group_metric = 650000 		if est03_e_group == 13
replace est03_e_group_metric = 700000 		if est03_e_group == 14
replace est03_e_group_metric = 750000 		if est03_e_group == 15
replace est03_e_group_metric = 800000 		if est03_e_group == 16
replace est03_e_group_metric = 850000 		if est03_e_group == 17
replace est03_e_group_metric = 900000 		if est03_e_group == 18
replace est03_e_group_metric = 950000 		if est03_e_group == 19
replace est03_e_group_metric = 1000000 		if est03_e_group == 20
replace est03_e_group_metric = 1100000 		if est03_e_group == 21
replace est03_e_group_metric = 1200000 		if est03_e_group == 22
replace est03_e_group_metric = 1300000 		if est03_e_group == 23
replace est03_e_group_metric = 1400000 		if est03_e_group == 24
replace est03_e_group_metric = 1500000 		if est03_e_group == 25
replace est03_e_group_metric = 1600000 		if est03_e_group == 26

gen exp_group = .
replace exp_group = 1 if  est15_c_group == . 	
replace exp_group = 0 if  est15_e_group == . 
replace exp_group = . if id == .
replace exp_group = . if est15_c_group == . & est15_e_group == .

label define group 0 "Control group" 1 "Treatment group" 
label values exp_group group

gen gender_2 = .
replace gender_2 = 0 if gender == 1
replace gender_2 = 1 if gender == 2

label define gender_2 0 "male" 1 "female"
label values gender_2 gender_2

label define gender 1 "Male" 2 "Female" 3 "Other"
label values gender gender


label variable exp_group "Treatment group"
label variable strain "Burden of COVID-19 pandemic (1-5)"
label variable gender_2 "male = 0 / female  = 1" 
label variable left_right "Left = 1 / right = 11"
label variable trust "General social trust (1-7)"
label variable restrict_rights "Restrict individual rights in order to guarantee safety (1-5)"
label variable measures_appropriate "Anti-Corona-measures appropriate (1-5)"  
label variable migration "Migration background"
label variable school_type "School type"
label variable infected "COVID-19 infected"
label variable COVID_affectedness "COVID-19 affectedness own family/friends (0/1)"  
label variable health_status "General health status (1-5)" 
label variable fear_of_infection "Fear of COVID-19 infection (1-5)"
label variable contact_reductions "Contact restrictions"
label variable mask_mandatory "Wearing masks mandatory at school"
label variable testing_mandatory "Mandatory testing at school" 
label variable alternate_lessons "Alternating online and in classroom teaching"
label variable vaccination_mandatory "Vaccination mandatory"
label variable post_exp_inform "Keeping myself informed about COVID-19"
label variable post_exp_test "Testing COVID-19 also during school holidays"
label variable post_exp_omikron_vacc "Getting vaccinated against the Omicron variant"
label variable post_exp_mask "Always wearing a mask at school"
label variable post_exp_contact "Reducing private contacts"
label variable age "Age"

*** descriptive statistics
* all participants dispcode == 31 have finished the survey
tab dispcode

* participants by school type and grade
asdoc tab class_level school_type  if dispcode == 31, save(analysis\table_S1.rtf) replace

set scheme plottigblind

* Fig S1: age, gender, vaccinated
* by age
graph bar if dispcode ==31, over( age) ytitle("percent") subtitle("Age") scale (0.8)
graph save "dump\S1_age.gph", replace

* by gender
graph pie if dispcode == 31, over(gender) plabel(_all per, size(small) gap(10) format(%4.1f)) legend(cols(2) pos(6)) subtitle("Gender")
graph save "dump\S1_sex.gph", replace

* by vaccinated
graph pie if dispcode == 31, over(vaccinated) plabel(_all per, size(small) gap(10) format(%4.1f))  legend(cols(2) pos(6)) subtitle("Vaccination status")
graph save "dump\S1_vac.gph", replace

graph combine "dump\S1_sex.gph" "dump\S1_vac.gph"
graph save "dump\S1_sex_vac.gph", replace

graph combine "dump\S1_age.gph" "dump\S1_sex_vac.gph", col (1) ysize(2) xsize(2) imargin(0 0 0 0)
graph export "analysis\Fig_S1.emf", replace

* Fig S2: Quiz
graph hbar, over(quiz_1,  label(labsize(small)))  ytitle("percent") ylabel(, labsize(small)) subtitle("Without countermeasures," "the Coronavirus spreads ...") xsize(8) ysize(4) bar(1, fcolor(gs9)) 
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(midgreen))) 
graph save "dump\quiz_1.gph", replace

graph hbar, over(quiz_2, label(labsize(small)))   ytitle("percent") ylabel(, labsize(small)) subtitle("The scientifically correct name" "of the Coronavirus is?") xsize(8) ysize(4) bar(1, fcolor(gs9)) 
gr_edit .plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(midgreen)))
graph save "dump\quiz_2.gph", replace

graph hbar, over(quiz_3, label(labsize(small)))   ytitle("percent") ylabel(, labsize(small)) subtitle("Who is heading the" "Robert Koch Institute (RKI)?") xsize(8) ysize(4) bar(1, fcolor(gs9)) 
gr_edit .plotregion1.bars[5].EditCustomStyle , j(-1) style(shadestyle(color(midgreen)))
graph save "dump\quiz_3.gph", replace

graph hbar, over(quiz_4,  relabel(  ///
					1 `""how many people an infected" "person infects on average.""' ///
					2 `""how long a person" "is contagious on average.""' ///
					3 `""how high the risk of" "infection by a person is.""' ///
					4 `""how long is the period in which" "the number of infected doubles.""' ///
					5 "how high the viral load is.") ///
					label(labsize(small)))   ytitle("percent") ylabel(, labsize(small)) subtitle("The R-value indicates...") xsize(8) ysize(4) scale (0.8) bar(1, fcolor(gs9)) 
gr_edit .plotregion1.bars[5].EditCustomStyle , j(-1) style(shadestyle(color(midgreen)))
graph save "dump\quiz_4.gph", replace

graph combine "dump\quiz_1.gph" "dump\quiz_2.gph" "dump\quiz_3.gph" , col(3)
graph save "dump\quiz_1-3.gph", replace

graph combine "dump\quiz_1-3.gph" "dump\quiz_4.gph", col(1)
graph export "analysis\Fig_S2.emf", replace

* Quiz points
gen quiz_correct_1 = 0
replace quiz_correct_1 = 1 if quiz_1 == 1

gen quiz_correct_2 = 0
replace quiz_correct_2 = 1 if quiz_2 == 2

gen quiz_correct_3 = 0
replace quiz_correct_3 = 1 if quiz_3 == 1

gen quiz_correct_4 = 0
replace quiz_correct_4 = 1 if quiz_4 == 1

gen quizpoints = quiz_correct_1 + quiz_correct_2 + quiz_correct_3 + quiz_correct_4

* Fig S3: infected, symptoms, fear of infection
set scheme plottigblind
graph pie if dispcode == 31, over(infected) plabel(_all per, size(small) gap(10) format(%4.1f))  legend(cols(1) pos(6)) title("COVID-19 infection") subtitle(" ", size(small)) pie(1, color(blue%55)) pie(2, color(red)) ptext(230 62 "N = 628", size(small))
graph save "dump\infected_1.gph", replace

graph pie if dispcode == 31, over(fear_of_infection) plabel(_all per, size(small) gap(10) format(%4.1f))  legend(cols(3) pos(6)) title("Fear of infection") subtitle("(in percent of those who have not been infected)", size(small)) ptext(230 62 "N = 505", size(small)) ///
	pie(1, color(blue%15)) pie(2, color(blue%35)) pie(3, color(blue%55)) pie(4, color(blue%75)) pie(5, color(blue%95))
graph save "dump\infected_2.gph", replace

graph combine "dump\infected_1.gph" "dump\infected_2.gph", plotregion(margin(tiny)) imargin(tiny)
graph save "dump\infected_1_2.gph", replace

graph hbar if dispcode == 31, over(symptoms_cough, label(labsize(small))) ytitle("")  ylabel(, labsize(small)) bar(1, color(red%100)) title("Cough", width(22)) text(70 -5 "N = 119", size(small))
gr_edit plotregion1.bars[2].EditCustomStyle , j(-1) style(shadestyle(color(%70)))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_1.gph", replace

graph hbar if dispcode == 31, over(symptoms_fever, label(labsize(small)))  ytitle("")  ylabel(, labsize(small)) bar(1, color(red%100)) title("Fever", width(22)) text(70 -5 "N = 117", size(small))
gr_edit plotregion1.bars[2].EditCustomStyle , j(-1) style(shadestyle(color(%70)))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_2.gph", replace

graph hbar if dispcode == 31, over(symptoms_snuff, label(labsize(small)))  ytitle("")  ylabel(, labsize(small)) bar(1, color(red%100)) title("Loss of sense of taste", width(22)) text(70 -5 "N = 119", size(small))
gr_edit plotregion1.bars[2].EditCustomStyle , j(-1) style(shadestyle(color(%70)))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_3.gph", replace

graph hbar if dispcode == 31, over(symptoms_smell, label(labsize(small)))  ytitle("")  ylabel(, labsize(small)) bar(1, color(red%100)) title("Loss of sense of smell", width(22)) text(70 -5 "N = 120", size(small))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_4.gph", replace

graph hbar if dispcode == 31, over(symptoms_sore, label(labsize(small)))  ytitle("")  ylabel(, labsize(small)) bar(1, color(red%100)) title("Sore throat", width(22)) text(70 -5 "N = 118", size(small))
gr_edit plotregion1.bars[2].EditCustomStyle , j(-1) style(shadestyle(color(%70)))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_5.gph", replace

graph hbar if dispcode == 31, over(symptoms_headache, label(labsize(small)))  ytitle("")  ylabel(, labsize(small)) bar(1, color(red%100)) title("Headache", width(22)) text(70 -5 "N = 121", size(small))
gr_edit plotregion1.bars[2].EditCustomStyle , j(-1) style(shadestyle(color(%70)))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_6.gph", replace

graph hbar if dispcode == 31, over(symptoms_nausea, label(labsize(small)))   ytitle("") ylabel(, labsize(small)) bar(1, color(red%100)) title("Nausea", width(22)) text(70 -5 "N = 118", size(small))
gr_edit plotregion1.bars[2].EditCustomStyle , j(-1) style(shadestyle(color(%70)))
gr_edit plotregion1.bars[3].EditCustomStyle , j(-1) style(shadestyle(color(%40)))
gr_edit plotregion1.bars[4].EditCustomStyle , j(-1) style(shadestyle(color(%20)))
graph save "dump\symptons_7.gph", replace

graph combine "dump\symptons_1.gph" "dump\symptons_2.gph" "dump\symptons_3.gph" "dump\symptons_4.gph" "dump\symptons_5.gph" "dump\symptons_6.gph" "dump\symptons_7.gph", col(3) title("Symptoms", size(small) margin(tiny)) subtitle("(in percent of those who have been infected)", size(vsmall)) ysize(3) xsize(2.5) xcomm
graph save "dump\symptons_all.gph", replace

graph combine "dump\infected_1_2.gph" "dump\symptons_all.gph", col(1) ysize(2.97) xsize(2.1) imargin(0 0 0 0)
graph export "analysis\Fig_S3.emf", replace

// * fear und symptoms für MI vorbereiten
// replace fear = 999 if fear == . & infected == 1
// replace symptoms_c = 999 if symptoms_c == . & infected == 0
// replace symptoms_fe = 999 if symptoms_fe == . & infected == 0
// replace symptoms_sn = 999 if symptoms_sn == . & infected == 0
// replace symptoms_sm = 999 if symptoms_sm == . & infected == 0
// replace symptoms_so = 999 if symptoms_so == . & infected == 0
// replace symptoms_he = 999 if symptoms_he == . & infected == 0
// replace symptoms_na = 999 if symptoms_na == . & infected == 0

* Table for Fig 2
gen str 	date_str = "03/28/2020" in 1
replace  	date_str = "03/31/2020" in 2
replace  	date_str = "04/03/2020" in 3
replace  	date_str = "04/06/2020" in 4
replace  	date_str = "04/09/2020" in 5

gen date = date(date_str, "MDY")
replace date = 22014.08 in 6
replace date = 22013.92 in 7
format date %dM_d 

gen lammers_exp_mean = .
gen lammers_control_mean = .
gen freiburg_exp_mean = .
gen freiburg_control_mean = .
gen lammers_exp_sd = .
gen lammers_control_sd = .
gen freiburg_exp_sd = .
gen freiburg_control_sd = .

sum lammers_est15_c_group_metric
replace lammers_control_mean = 	r(mean) in 6
replace lammers_control_sd = 	r(sd) 	in 6

sum lammers_est03_e_group_metric
replace lammers_exp_mean = 	r(mean) in 1
replace lammers_exp_sd = 	r(sd) 	in 1

sum lammers_est06_e_group_metric
replace lammers_exp_mean = 	r(mean) in 2
replace lammers_exp_sd = 	r(sd) 	in 2

sum lammers_est09_e_group_metric
replace lammers_exp_mean = 	r(mean) in 3
replace lammers_exp_sd = 	r(sd) 	in 3

sum lammers_est12_e_group_metric
replace lammers_exp_mean = 	r(mean) in 4
replace lammers_exp_sd = 	r(sd) 	in 4

sum lammers_est15_e_group_metric
replace lammers_exp_mean = 	r(mean) in 5
replace lammers_exp_sd = 	r(sd) 	in 5


sum est15_c_group_metric
replace freiburg_control_mean 	= 	r(mean) in 7
replace freiburg_control_sd 	= 	r(sd) 	in 7

sum est03_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 1
replace freiburg_exp_sd 	= 	r(sd) 	in 1

sum est06_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 2
replace freiburg_exp_sd 	= 	r(sd) 	in 2

sum est09_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 3
replace freiburg_exp_sd 	= 	r(sd) 	in 3

sum est12_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 4
replace freiburg_exp_sd 	= 	r(sd) 	in 4

sum est15_e_group_metric
replace freiburg_exp_mean 	= 	r(mean) in 5
replace freiburg_exp_sd 	= 	r(sd) 	in 5

gen lammers_control_minus_sd = lammers_control_mean - lammers_control_sd
gen lammers_control_plus_sd = lammers_control_mean + lammers_control_sd
gen freiburg_control_minus_sd = freiburg_control_mean - freiburg_control_sd
gen freiburg_control_plus_sd = freiburg_control_mean + freiburg_control_sd
gen lammers_exp_minus_sd = lammers_exp_mean - lammers_exp_sd
gen lammers_exp_plus_sd = lammers_exp_mean + lammers_exp_sd
gen freiburg_exp_minus_sd = freiburg_exp_mean - freiburg_exp_sd
gen freiburg_exp_plus_sd = freiburg_exp_mean + freiburg_exp_sd

set scheme plottig 

* merge means and sd from university student survey (cp. Jäckle/Ettensperger: Boosting the Understanding and Approval of Anti-Corona Measures–Reducing Exponential Growth Bias and its Effects through Educational Nudges, Swiss Political Science Review, 2021: https://doi.org/10.1111/spsr.12479  
merge 1:1 _n using "material\university_students_survey.dta" , gen(merge_uni_students)

	
* Freiburg pupils vs. Freiburg university students vs. Lammers et al. 2020 (including +- 1 SD)		
twoway 	(rarea lammers_exp_minus_sd lammers_exp_plus_sd date, fcolor(black%20) lcolor(black%20) lwidth(none)) 											///
		(connected lammers_exp_mean date, lcolor(black) lpattern(dash) mcolor(black) msymbol(Oh)) 														///
		(rarea students_exp_minus_sd students_exp_plus_sd date, fcolor(green%20) lcolor(green%20) lwidth(none)) 										///
		(connected students_exp_mean date, lcolor(green) lpattern(dash) mcolor(green) msymbol(Oh)) 														///
		(rarea freiburg_exp_minus_sd freiburg_exp_plus_sd date, fcolor(red%30) lcolor(red%30) lwidth(none)) 											///
		(connected freiburg_exp_mean date, lcolor(red) mcolor(red)  msymbol(Sh)) 																		///
		(scatter lammers_control_mean date, mcolor(black) msymbol(circle))																				///
		(rcap lammers_control_minus_sd lammers_control_plus_sd date, lcolor(black%20)) 																	///
		(scatter students_control_mean date, mcolor(green) msymbol(circle))																				///
		(rcap students_control_minus_sd students_control_plus_sd date, lcolor(green%20)) 																///
		(scatter freiburg_control_mean date, mcolor(red) msymbol(square)) 																				///
		(rcap freiburg_control_minus_sd freiburg_control_plus_sd date, lcolor(red%30)),																	///
xlabel(22002(3)22014) 																																	///
ytitle("Estimation of SARS-CoV-2 infections")																											///
xtitle("")																																				///
ylabel(, format(%15.0fc)) 																																///
legend(cols(2) on order( 6 "Treatment group"  11 "Control group" 4 "Treatment group" 9 "Control group" 2 "Treatment group" 7 "Control group")  	///																																				
position(5)) plegend(position(6))																														///
text(-430000 22000.24  "School students (GER), Feb 2022 (present study)" -560000 22000.2 "University students (GER), Nov 2020 (Jäckle/Ettensperger 2021)" -690000 22000.2 "MTurk sample (USA), Mar 2020 (Lammers et al. 2020)", size(small) placement(right))
graph export "analysis\fig_2.pdf", replace
graph export "analysis\fig_2.emf", replace

* Estimation of Infections in 15 days (control group and experimental group)
gen 	est15_both_groups_metric = est15_c_group_metric
replace est15_both_groups_metric = est15_e_group_metric if est15_e_group_metric != . 

* completed i.e. experiment finished (final estimation after 15 days: 
gen completed = 1 if est15_both_groups_metric != .

* testing equality of variances
sdtest est15_both_groups_metric if completed == 1 , by(exp_group)
* --> variances are equal not equal
robvar est15_both_groups_metric if completed == 1 , by(exp_group)
* --> variances are not equal according to Levene's Test (W0) und Levene's Test using the 10% trimmed mean (W10). Accordig Levene's Test using the median(W50) the variances are equal.

 * t-test comparing means of estimations after 15 days (control vs. experimental group)
ttest est15_both_groups_metric if completed == 1 , by(exp_group) welch unequal 
/// Welch approximation for unequal variances
*ttest est15_both_groups_metric if completed == 1 , by(exp_group) unequal /// Satterwaithe Approximation

* Table: experimental/control group vs. social distancing measures
tab contact_reductions 		exp_group if completed ==1, row
tab mask_mandatory 			exp_group if completed ==1, row
tab testing_mandatory 		exp_group if completed ==1, row
tab alternate_lessons 		exp_group if completed ==1, row
tab vaccination_mandatory 	exp_group if completed ==1, row

* Mann-Whitney-U-Test experimental/control group vs. social distancing measures
ranksum contact_reductions  	if completed ==1,  by(exp_group)
ranksum mask_mandatory			if completed ==1,  by(exp_group)
ranksum testing_mandatory  		if completed ==1,  by(exp_group)
ranksum alternate_lessons 		if completed ==1,  by(exp_group)
ranksum vaccination_mandatory 	if completed ==1,  by(exp_group)

* Table: experimental/control group vs. own actions after experiment
tab post_exp_inform 		exp_group if completed ==1, row
tab post_exp_test 			exp_group if completed ==1, row
tab post_exp_omikron_vacc	exp_group if completed ==1, row
tab post_exp_mask			exp_group if completed ==1, row
tab post_exp_contact	 	exp_group if completed ==1, row

* Mann-Whitney-U-Test experimental/control group vs. own actions after experiment
ranksum post_exp_inform 	  	if completed ==1,  by(exp_group)
ranksum post_exp_test			if completed ==1,  by(exp_group)
ranksum post_exp_omikron_vacc	if completed ==1,  by(exp_group)
ranksum post_exp_mask			if completed ==1,  by(exp_group)
ranksum post_exp_contact	 	if completed ==1,  by(exp_group)

* t-test (Assumption: 10-point scale is interval-scale)
sdtest contact_reductions  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest contact_reductions  if completed ==1,  by(exp_group) 

sdtest mask_mandatory  if completed ==1,  by(exp_group)
	* --> equal variances
ttest mask_mandatory  if completed ==1,  by(exp_group) 
	
sdtest testing_mandatory  if completed ==1,  by(exp_group)
	* --> equal variances
ttest testing_mandatory  if completed ==1,  by(exp_group) 

sdtest alternate_lessons  if completed ==1,  by(exp_group)
	* --> equal variances
ttest alternate_lessons  if completed ==1,  by(exp_group) 

sdtest vaccination_mandatory  if completed ==1,  by(exp_group)
	* --> equal variances
ttest vaccination_mandatory  if completed ==1,  by(exp_group)


* t-test (Assumption: 4-point scale is interval-scale)
sdtest post_exp_inform  if completed ==1,  by(exp_group) 
	* --> equal variances
ttest post_exp_inform  if completed ==1,  by(exp_group) 

sdtest post_exp_test  if completed ==1,  by(exp_group)
	* --> equal variances
ttest post_exp_test  if completed ==1,  by(exp_group) 
	
sdtest post_exp_omikron_vacc  if completed ==1,  by(exp_group)
	* --> equal variances
ttest post_exp_omikron_vacc  if completed ==1,  by(exp_group) 

sdtest post_exp_mask  if completed ==1,  by(exp_group)
	* --> equal variances
ttest post_exp_mask  if completed ==1,  by(exp_group) 

sdtest post_exp_contact  if completed ==1,  by(exp_group)
	* --> equal variances
ttest post_exp_contact  if completed ==1,  by(exp_group)

*** Figure 3: Stripplots of DV-1 by experimental/control group 
stripplot contact_reductions, 	vertical stack center  over(exp_group) title("Contact restrictions") ytitle("") ms(oh) mc(black%30) jitter(1) msize(small) xtitle("") refline(lcolor(red)) 
graph save "dump\fig3_a.gph", replace
stripplot mask_mandatory,	vertical stack center  over(exp_group) title("Wearing masks mandatorily at school") ytitle("") ms(oh) mc(black%30) jitter(1) msize(small) xtitle("") refline(lcolor(red)) 
graph save "dump\fig3_b.gph", replace
stripplot testing_mandatory, 		vertical stack center  over(exp_group) title("Mandatory testing at schools") ytitle("") ms(oh) mc(black%30) jitter(1) msize(small) xtitle("") refline(lcolor(red)) 
graph save "dump\fig3_c.gph", replace
stripplot alternate_lessons, 		vertical stack center  over(exp_group) title("Alternating online and classroom teaching") ytitle("") ms(oh) mc(black%30) jitter(1) msize(small) xtitle("") refline(lcolor(red)) 
graph save "dump\fig3_d.gph", replace
stripplot vaccination_mandatory, 		vertical stack center  over(exp_group) title("Vaccination mandatory") ytitle("") ms(oh) mc(black%30) jitter(1) msize(small) xtitle("") refline(lcolor(red)) 
graph save "dump\fig3_e.gph", replace

graph combine "dump\fig3_a.gph" "dump\fig3_b.gph" "dump\fig3_c.gph" "dump\fig3_d.gph" "dump\fig3_e.gph",  note("1 = strongly oppose, 10 = strongly support", tstyle(size(vsmall))) 
graph export "analysis\fig_3.pdf", replace
graph export "analysis\fig_3.emf", replace

*** Figure 4: Stripplots of DV-2 by experimental/control group 
stripplot post_exp_inform, 	vertical stack center  over(exp_group) title("Keeping myself informed about COVID-19") ytitle("") ms(oh) mc(black%30) jitter(4) msize(small) xtitle("") refline(lcolor(red)) 
graph save "dump\fig4_a.gph", replace
stripplot post_exp_test,	vertical stack center  over(exp_group) title("Testing COVID-19 also during school holidays") ytitle("") ms(oh) mc(black%30) jitter(4) xtitle("") refline(lcolor(red)) 
graph save "dump\fig4_b.gph", replace
stripplot post_exp_omikron_vacc, 		vertical stack center  over(exp_group) title("Getting vaccinated against the Omicron variant") ytitle("") ms(oh) mc(black%30) jitter(4) xtitle("") refline(lcolor(red)) 
graph save "dump\fig4_c.gph", replace
stripplot post_exp_mask, 		vertical stack center  over(exp_group) title("Always wearing a mask at school") ytitle("") ms(oh) mc(black%30) jitter(4) xtitle("") refline(lcolor(red)) 
graph save "dump\fig4_d.gph", replace
stripplot post_exp_contact, 		vertical stack center  over(exp_group) title("Reducing private contacts") ytitle("") ms(oh) mc(black%30) jitter(4) xtitle("") refline(lcolor(red)) 
graph save "dump\fig4_e.gph", replace

graph combine "dump\fig4_a.gph" "dump\fig4_b.gph" "dump\fig4_c.gph" "dump\fig4_d.gph" "dump\fig4_e.gph",  note("1 = no, in no case, 4 = yes, in any case", tstyle(size(vsmall))) 
graph export "analysis\fig_4.pdf", replace
graph export "analysis\fig_4.emf", replace

* descriptive statistics + missings
estpost sum contact_reductions mask_mandatory testing_mandatory alternate_lessons vaccination_mandatory post_exp_inform post_exp_test post_exp_omikron_vacc post_exp_mask post_exp_contact exp_group gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  school_type knowledge_COVID_oneself  quizpoints fear symptoms*  if exp_group !=. 
esttab using "analysis\table_S2.rtf", cells("mean(fmt(3)) sd(fmt(3)) min(fmt(0)) max(fmt(0)) count(fmt(0))")  replace 
misstable sum 	contact_reductions mask_mandatory testing_mandatory alternate_lessons vaccination_mandatory post_exp_inform post_exp_test post_exp_omikron_vacc post_exp_mask post_exp_contact exp_group gender left_right trust eff_COVID_understand migration_background school_type class_level size infected COVID_affectedness knowledge_COVID_oneself  restrict_rights strain quizpoints fear symptoms* age health_status if exp_group !=.
mdesc 			contact_reductions mask_mandatory testing_mandatory alternate_lessons vaccination_mandatory post_exp_inform post_exp_test post_exp_omikron_vacc post_exp_mask post_exp_contact exp_group gender left_right trust eff_COVID_understand migration_background school_type class_level size infected COVID_affectedness knowledge_COVID_oneself  restrict_rights strain quizpoints fear symptoms* age health_status if exp_group !=.	

 * dummies instead of categorical data
 gen gender_male = .
 replace gender_male = 1 if gender == 1
 replace gender_male = 0 if gender == 2 | gender == 3
 
 gen gender_female = .
 replace gender_female = 1 if gender == 2
 replace gender_female = 0 if gender ==1 | gender == 3
 
 gen gender_other = .
 replace gender_other = 1 if gender == 3
 replace gender_other = 0 if gender == 1 | gender == 2
 
 gen school_realschule = .
 replace school_realschule = 1 if school_type == 3
 replace school_realschule = 0 if school_type == 5 | school_type == 7
 
 gen school_gymnasium = .
 replace school_gymnasium = 1 if school_type == 5
 replace school_gymnasium = 0 if school_type == 3 | school_type == 7
 
 gen school_berufsschule = .
 replace school_berufsschule = 1 if school_type == 7
 replace school_berufsschule = 0 if school_type == 3 | school_type == 5

*** multiple imputation
mi set mlong

mi register imputed contact_reductions mask_mandatory testing_mandatory alternate_lessons vaccination_mandatory post_exp_inform post_exp_test post_exp_omikron_vacc post_exp_mask post_exp_contact gender left_right trust eff_COVID_understand migration_background school_type  size infected COVID_affectedness knowledge_COVID_oneself  restrict_rights strain quizpoints fear symptoms* age health_status


#delimit ;			
 mi impute chained 
		(logit, augment) migration_background infected  COVID_affectedness  
		(mlogit, augment) school_type
		(pmm, knn(10)) gender  post_exp_inform post_exp_test post_exp_omikron_vacc post_exp_mask post_exp_contact eff_COVID_understand  size knowledge_COVID_oneself  restrict_rights strain fear symptoms* contact_reductions mask_mandatory testing_mandatory alternate_lessons vaccination_mandatory   age left_right trust  =  quizpoints 
		, add(25) rseed(1492)  noisily dots  augment;
#delimit cr	

		*  

// * fear and symptoms missing
// replace fear = . if fear == 999
// replace symptoms_c = . if symptoms_c == 999
// replace symptoms_f = . if symptoms_f == 999
// replace symptoms_sn = . if symptoms_sn == 999
// replace symptoms_sm = . if symptoms_sm == 999
// replace symptoms_so = . if symptoms_so == 999
// replace symptoms_he = . if symptoms_he == 999
// replace symptoms_na = . if symptoms_na == 999

* M1
reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m1, title(M1)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M2
reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg mask_mandatory exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type , robust
eststo m2, title(M2)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	


* M3
reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg testing_mandatory exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type , robust
eststo m3, title(M3)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M4
reg alternate_lessons exp_group i.gender age migration_background  left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m4, title(M4)

coefplot, drop(_cons) xline(0) msymbol(d) mcolor(white) levels(95 90 ) ciopts(lwidth(3 ..) lcolor(*.33 *.66 )) headings(2.gender="{it:Gender (reference = male)}" 3.school_type="{it:School type (reference = Gymnasium)}") ///
legend(order( 1 "95%" 2 "90%" ) rows(1) position(6))
gr_edit yaxis1.edit_tick 7 9 `"General social trust (1–7)"', tickset(major)
gr_edit yaxis1.edit_tick 8 10 `"Restrict individual rights in order to guarantee safety (1–5)"', tickset(major)
gr_edit yaxis1.edit_tick 9 11 `"Burden of COVID-19 pandemic (1–5)"', tickset(major)
gr_edit yaxis1.edit_tick 11 13 `"General health status (1–5)"', tickset(major)
gr_edit xaxis1.edit_tick 1 -3 `"−3"', tickset(major)
gr_edit xaxis1.edit_tick 1 -2 `"−2"', tickset(major)
gr_edit xaxis1.edit_tick 1 -1 `"−1"', tickset(major)
graph export "analysis\fig_5.pdf", replace
graph export "analysis\fig_5.emf", replace

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M5
reg vaccination_mandatory exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* hettest: heteroscedasticity --> robust se
mi estimate, post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  , robust 
eststo m5, title(M5)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

esttab m1 m2 m3 m4 m5 using "analysis\table_S3.rtf",  ar2 pr2 (2)replace star(* 0.10 ** 0.05 *** 0.01)  legend label

* M6
reg post_exp_inform exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* hettest: heteroscedasticity --> robust se
mi estimate, post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  , robust 
eststo m6, title(M6)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M7
reg post_exp_test exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* hettest: heteroscedasticity --> robust se
mi estimate, post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  , robust 
eststo m7, title(M7)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M8
reg post_exp_omikron exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* hettest: heteroscedasticity --> robust se
mi estimate, post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  , robust 
eststo m8, title(M8)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M9
reg post_exp_mask exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* hettest: heteroscedasticity --> robust se
mi estimate, post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  , robust 
eststo m9, title(M9)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2

* M10
reg post_exp_contact exp_group i.gender age migration_background  left   trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* hettest: heteroscedasticity --> robust se
mi estimate, post: reg post_exp_contact exp_group i.gender migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  , robust 
eststo m10, title(M10)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2

esttab m6 m7 m8 m9 m10 using "analysis\table_S4.rtf",  ar2 pr2 (2)replace star(* 0.10 ** 0.05 *** 0.01)  legend label

* additional models checking fear of COVID-19 for those not infected

* M1_fear
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_1, title(M1_fear)
* M2_fear
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_2, title(M2_fear)
* M3_fear
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_3, title(M3_fear)
* M4_fear
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_4, title(M4_fear)	
* M5_fear
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_5, title(M5_fear)	

* M6_fear
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_6, title(M6_fear)
* M7_fear
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_7, title(M7_fear)
* M8_fear
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_8, title(M8_fear)
* M9_fear
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_9, title(M9_fear)	
* M10_fear
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type fear  if infected == 0, robust 
eststo fear_10, title(M10_fear)	

* Fig S4
coefplot 	(fear_1, label(M1: Contact restrictions)) ///
			(fear_2, label(M2: Wearing masks mandatorily at school)) ///
			(fear_3, label(M3: Mandatory testing at school)) ///
			(fear_4, label(M4: Alternating online and in classroom teaching)) ///
			(fear_5, label(M5: Vaccination mandatory)) ///
		 	(fear_6, label(M6: Keeping myself informed about COVID-19)) ///
			(fear_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(fear_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(fear_9, label(M9: Wearing always a mask at school)) ///
			(fear_10, label(M10: Reducing private contacts)) ///
		, keep(*:fear_of_infection) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 ))  legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		xlabel(, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -0.5 `"−0.5"', tickset(major)
graph export "analysis\Fig_S4.emf", replace 


* Fig S5_a		
* M1_symptoms_cough
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_1, title(M1_symptoms_cough)		
* M2_symptoms_cough
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_2, title(M2_symptoms_cough)				
* M3_symptoms_cough
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_3, title(M3_symptoms_cough)		
* M4_symptoms_cough
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_4, title(M4_symptoms_cough)		
* M5_symptoms_cough
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_5, title(M5_symptoms_cough)		

* M6_symptoms_cough
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_6, title(M6_symptoms_cough)		
* M7_symptoms_cough
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_7, title(M7_symptoms_cough)		
* M8_symptoms_cough
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_8, title(M8_symptoms_cough)		
* M9_symptoms_cough
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_9, title(M9_symptoms_cough)		
* M10_symptoms_cough
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_c  if infected == 1, robust 
eststo symptoms_cough_10, title(M10_symptoms_cough)				
	
coefplot 	(symptoms_cough_1, label(M1: Contact restrictions)) ///
			(symptoms_cough_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_cough_3, label(M3: Mandatory testing at school)) ///
			(symptoms_cough_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_cough_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_cough_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_cough_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_cough_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_cough_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_cough_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_cough) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Cough) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_a.gph", replace
	
* Fig S5_b		
* M1_symptoms_fever
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_1, title(M1_symptoms_fever)		
* M2_symptoms_fever
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_2, title(M2_symptoms_fever)				
* M3_symptoms_fever
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_3, title(M3_symptoms_fever)		
* M4_symptoms_fever
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_4, title(M4_symptoms_fever)		
* M5_symptoms_fever
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_5, title(M5_symptoms_fever)		

* M6_symptoms_fever
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_6, title(M6_symptoms_fever)		
* M7_symptoms_fever
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_7, title(M7_symptoms_fever)		
* M8_symptoms_fever
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_8, title(M8_symptoms_fever)		
* M9_symptoms_fever
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_9, title(M9_symptoms_fever)		
* M10_symptoms_fever
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_fever  if infected == 1, robust 
eststo symptoms_fever_10, title(M10_symptoms_fever)				
	
coefplot 	(symptoms_fever_1, label(M1: Contact restrictions)) ///
			(symptoms_fever_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_fever_3, label(M3: Mandatory testing at school)) ///
			(symptoms_fever_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_fever_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_fever_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_fever_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_fever_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_fever_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_fever_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_fever) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Fever) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_b.gph", replace	
		
* Fig S5_c		
* M1_symptoms_snuff
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_1, title(M1_symptoms_snuff)		
* M2_symptoms_snuff
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_2, title(M2_symptoms_snuff)				
* M3_symptoms_snuff
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_3, title(M3_symptoms_snuff)		
* M4_symptoms_snuff
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_4, title(M4_symptoms_snuff)		
* M5_symptoms_snuff
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_5, title(M5_symptoms_snuff)		

* M6_symptoms_snuff
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_6, title(M6_symptoms_snuff)		
* M7_symptoms_snuff
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_7, title(M7_symptoms_snuff)		
* M8_symptoms_snuff
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_8, title(M8_symptoms_snuff)		
* M9_symptoms_snuff
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_9, title(M9_symptoms_snuff)		
* M10_symptoms_snuff
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_snuff  if infected == 1, robust 
eststo symptoms_snuff_10, title(M10_symptoms_snuff)				
	
coefplot 	(symptoms_snuff_1, label(M1: Contact restrictions)) ///
			(symptoms_snuff_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_snuff_3, label(M3: Mandatory testing at school)) ///
			(symptoms_snuff_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_snuff_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_snuff_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_snuff_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_snuff_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_snuff_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_snuff_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_snuff) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Loss of sense of taste) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_c.gph", replace	

* Fig S5_d		
* M1_symptoms_smell
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_1, title(M1_symptoms_smell)		
* M2_symptoms_smell
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_2, title(M2_symptoms_smell)				
* M3_symptoms_smell
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_3, title(M3_symptoms_smell)		
* M4_symptoms_smell
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_4, title(M4_symptoms_smell)		
* M5_symptoms_smell
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_5, title(M5_symptoms_smell)		

* M6_symptoms_smell
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_6, title(M6_symptoms_smell)		
* M7_symptoms_smell
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_7, title(M7_symptoms_smell)		
* M8_symptoms_smell
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_8, title(M8_symptoms_smell)		
* M9_symptoms_smell
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_9, title(M9_symptoms_smell)		
* M10_symptoms_smell
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_smell  if infected == 1, robust 
eststo symptoms_smell_10, title(M10_symptoms_smell)				
	
coefplot 	(symptoms_smell_1, label(M1: Contact restrictions)) ///
			(symptoms_smell_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_smell_3, label(M3: Mandatory testing at school)) ///
			(symptoms_smell_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_smell_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_smell_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_smell_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_smell_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_smell_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_smell_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_smell) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Loss of sense of smell) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_d.gph", replace			

		
* Fig S5_e		
* M1_symptoms_sore_throat
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_1, title(M1_symptoms_sore_throat)		
* M2_symptoms_sore_throat
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_2, title(M2_symptoms_sore_throat)				
* M3_symptoms_sore_throat
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_3, title(M3_symptoms_sore_throat)		
* M4_symptoms_sore_throat
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_4, title(M4_symptoms_sore_throat)		
* M5_symptoms_sore_throat
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_5, title(M5_symptoms_sore_throat)		

* M6_symptoms_sore_throat
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_6, title(M6_symptoms_sore_throat)		
* M7_symptoms_sore_throat
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_7, title(M7_symptoms_sore_throat)		
* M8_symptoms_sore_throat
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_8, title(M8_symptoms_sore_throat)		
* M9_symptoms_sore_throat
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_9, title(M9_symptoms_sore_throat)		
* M10_symptoms_sore_throat
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_sore_throat  if infected == 1, robust 
eststo symptoms_sore_throat_10, title(M10_symptoms_sore_throat)				
	
coefplot 	(symptoms_sore_throat_1, label(M1: Contact restrictions)) ///
			(symptoms_sore_throat_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_sore_throat_3, label(M3: Mandatory testing at school)) ///
			(symptoms_sore_throat_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_sore_throat_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_sore_throat_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_sore_throat_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_sore_throat_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_sore_throat_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_sore_throat_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_sore_throat) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Sore throat) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_e.gph", replace	


* Fig S5_f		
* M1_symptoms_headache
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_1, title(M1_symptoms_headache)		
* M2_symptoms_headache
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_2, title(M2_symptoms_headache)				
* M3_symptoms_headache
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_3, title(M3_symptoms_headache)		
* M4_symptoms_headache
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_4, title(M4_symptoms_headache)		
* M5_symptoms_headache
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_5, title(M5_symptoms_headache)		

* M6_symptoms_headache
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_6, title(M6_symptoms_headache)		
* M7_symptoms_headache
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_7, title(M7_symptoms_headache)		
* M8_symptoms_headache
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_8, title(M8_symptoms_headache)		
* M9_symptoms_headache
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_9, title(M9_symptoms_headache)		
* M10_symptoms_headache
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_headache  if infected == 1, robust 
eststo symptoms_headache_10, title(M10_symptoms_headache)				
	
coefplot 	(symptoms_headache_1, label(M1: Contact restrictions)) ///
			(symptoms_headache_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_headache_3, label(M3: Mandatory testing at school)) ///
			(symptoms_headache_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_headache_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_headache_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_headache_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_headache_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_headache_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_headache_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_headache) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Headache) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_f.gph", replace	

		
* Fig S5_g		
* M1_symptoms_nausea
mi estimate, esampvaryok post: reg contact_reductions exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_1, title(M1_symptoms_nausea)		
* M2_symptoms_nausea
mi estimate, esampvaryok post: reg mask_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_2, title(M2_symptoms_nausea)				
* M3_symptoms_nausea
mi estimate, esampvaryok post: reg testing_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_3, title(M3_symptoms_nausea)		
* M4_symptoms_nausea
mi estimate, esampvaryok post: reg alternate_lessons exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_4, title(M4_symptoms_nausea)		
* M5_symptoms_nausea
mi estimate, esampvaryok post: reg vaccination_mandatory exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_5, title(M5_symptoms_nausea)		

* M6_symptoms_nausea
mi estimate, esampvaryok post: reg post_exp_inform exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_6, title(M6_symptoms_nausea)		
* M7_symptoms_nausea
mi estimate, esampvaryok post: reg post_exp_test exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_7, title(M7_symptoms_nausea)		
* M8_symptoms_nausea
mi estimate, esampvaryok post: reg post_exp_omikron exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_8, title(M8_symptoms_nausea)		
* M9_symptoms_nausea
mi estimate, esampvaryok post: reg post_exp_mask exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_9, title(M9_symptoms_nausea)		
* M10_symptoms_nausea
mi estimate, esampvaryok post: reg post_exp_contact exp_group i.gender age migration_background   left  trust restrict_rights  strain  health_status COVID_affectedness  b5.school_type symptoms_nausea  if infected == 1, robust 
eststo symptoms_nausea_10, title(M10_symptoms_nausea)				
	
coefplot 	(symptoms_nausea_1, label(M1: Contact restrictions)) ///
			(symptoms_nausea_2, label(M2: Wearing masks mandatorily at school)) ///
			(symptoms_nausea_3, label(M3: Mandatory testing at school)) ///
			(symptoms_nausea_4, label(M4: Alternating online and in classroom teaching)) ///
			(symptoms_nausea_5, label(M5: Vaccination mandatory)) ///
		 	(symptoms_nausea_6, label(M6: Keeping myself informed about COVID-19)) ///
			(symptoms_nausea_7, label(M7: Testing COVID-19 also during school holidays)) ///
			(symptoms_nausea_8, label(M8: Getting vaccinated against the Omicron variant)) ///
			(symptoms_nausea_9, label(M9: Wearing always a mask at school)) ///
			(symptoms_nausea_10, label(M10: Reducing private contacts)) ///
		, keep(*:symptoms_nausea) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title (Nausea) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2) ///
		 xsc(r(-1 2)) xlabel(-1[0.5]2, format(%2.1f))
		* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -1 `"−1.0"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.5 `"−0.5"', tickset(major)
		graph save "dump\Fig_S5_g.gph", replace			
		
		
		
grc1leg "dump\Fig_S5_a.gph" "dump\Fig_S5_b.gph" "dump\Fig_S5_c.gph" "dump\Fig_S5_d.gph" "dump\Fig_S5_e.gph" "dump\Fig_S5_f.gph" "dump\Fig_S5_g.gph", ysize(2.97) xsize(2.1) imargin(0 0 0 0)
gr_edit .style.editstyle declared_ysize(2.97) editcopy
gr_edit  .style.editstyle declared_xsize(2.1) editcopy	
graph export "analysis\Fig_S5.emf", replace


* subjective and objective knowledge Modelle
* M11
reg contact_reductions exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg contact_reductions  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m11, title(M11)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg contact_reductions  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg contact_reductions  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M12
reg mask_mandatory exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg mask_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m12, title(M12)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg mask_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg mask_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M13
reg testing_mandatory exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg testing_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m13, title(M13)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg testing_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg testing_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M14
reg alternate_lessons exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg alternate_lessons  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m14, title(M14)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg alternate_lessons  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg alternate_lessons  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M15
reg vaccination_mandatory exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg vaccination_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m15, title(M15)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg vaccination_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg vaccination_mandatory  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	

* M16
reg post_exp_inform exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg post_exp_inform  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m16, title(M16)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_inform  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_inform  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	
	
* M17
reg post_exp_test exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg post_exp_test  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m17, title(M17)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_test  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_test  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2		
	
* M18
reg post_exp_omikron exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg post_exp_omikron  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m18, title(M18)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_omikron  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_omikron  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2		
	
* M19
reg post_exp_mask exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg post_exp_mask  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m19, title(M19)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_mask  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_mask  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	
	
* M20
reg post_exp_contact exp_group knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type  if _mi_m == 0
hettest
estat imtest, white
* heteroscedasticity --> robust se
mi estimate, post: reg post_exp_contact  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type   , robust
eststo m20, title(M20)

	* Berechnung mean R2 nach https://www.stata.com/support/faqs/statistics/combine-results-with-multiply-imputed-data/
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M':  reg post_exp_contact  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust ; scalar r2 = r2 + e(r2)
	scalar r2 = r2/`M'
	di as txt "R2 over imputed data = " as res r2

	* Berechnung mean R2 using Fishers Z
	mi query
	local M = r(M)
	scalar r2 = 0
	mi xeq 1/`M': reg post_exp_contact  knowledge_COVID_oneself quizpoints i.gender age migration_background   left  trust restrict_rights  strain infected health_status COVID_affectedness  b5.school_type, robust  ; scalar r2 = r2 + atanh(sqrt(e(r2)))
	scalar r2 = tanh(r2/`M')^2
	di as txt "R2 using Fisher's z over imputed data = " as res r2	
	
coefplot 	(m11, label(M1: Contact restrictions)) ///
			(m12, label(M2: Wearing masks mandatorily at school)) ///
			(m13, label(M3: Mandatory testing at school)) ///
			(m14, label(M4: Alternating online and in classroom teaching)) ///
			(m15, label(M5: Vaccination mandatory)) ///
		 	(m16, label(M6: Keeping myself informed about COVID-19)) ///
			(m17, label(M7: Testing COVID-19 also during school holidays)) ///
			(m18, label(M8: Getting vaccinated against the Omicron variant)) ///
			(m19, label(M9: Wearing always a mask at school)) ///
			(m20, label(M10: Reducing private contacts)) ///
		, keep(*:knowledge_COVID_oneself) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title(Subjective knowledge COVID-19) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2)	///
		xsc(r(-.04 0.4)) xlabel(-0.4[0.2]0.4, format(%2.1f))
* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -0.4 `"−0.4"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.2 `"−0.2"', tickset(major)
		graph save "dump\Fig_6a.gph", replace

coefplot 	(m11, label(M1: Contact restrictions)) ///
			(m12, label(M2: Wearing masks mandatorily at school)) ///
			(m13, label(M3: Mandatory testing at school)) ///
			(m14, label(M4: Alternating online and in classroom teaching)) ///
			(m15, label(M5: Vaccination mandatory)) ///
		 	(m16, label(M6: Keeping myself informed about COVID-19)) ///
			(m17, label(M7: Testing COVID-19 also during school holidays)) ///
			(m18, label(M8: Getting vaccinated against the Omicron variant)) ///
			(m19, label(M9: Wearing always a mask at school)) ///
			(m20, label(M10: Reducing private contacts)) ///
		, keep(*:quizpoints) xline(0) msymbol(d)  levels(95 90 ) ciopts(lwidth(2 ..) lcolor(*.33 *.66 )) title(Objective knowledge COVID-19) legend(pos(6) col(1) title(Model / dependent variable, size(small))) ysize(3) xsize(2)	///
		xsc(r(-.04 0.4)) xlabel(-0.4[0.2]0.4, format(%2.1f))
* delete tick + label
		gr_edit .yaxis1.major.delete_tick 1
		gr_edit xaxis1.edit_tick 1 -0.4 `"−0.4"', tickset(major)
		gr_edit xaxis1.edit_tick 2 -0.2 `"−0.2"', tickset(major)
		graph save "dump\Fig_6b.gph", replace
	
grc1leg "dump\Fig_6a.gph" "dump\Fig_6b.gph" , ysize(2.97) xsize(2.1) imargin(0 0 0 0)
gr_edit .style.editstyle declared_ysize(3) editcopy
gr_edit  .style.editstyle declared_xsize(3) editcopy	
graph export "analysis\Fig_6.emf", replace
	
	
















